package com.nanmeishu.services.upload.controller;


import com.nanmeishu.services.upload.facade.IUploadService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;

@RestController
@RequestMapping("/upload")
public class UploadController {
    @Autowired
    IUploadService uploadService;

//    public static void main(String[] args) {
//        System.out.println(QiNiuUtils.uploadByPath("C:\\Users\\admin\\Desktop\\材料整理\\心情素材\\烦躁.png"));
//    }

    @ApiOperation("文件上传接口")
    @PostMapping("/upload")
    public String upload(@RequestParam("file") MultipartFile file) throws IOException {
        return uploadService.upload(file);
    }
}
